<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		Broadcastweb.eu - Paules												/
/	Site:			http://www.broadcastweb.eu												/
/	Email:			support@broadcastweb.eu													/
/	Copyright:		2011 - 2012 (c) Broadcastweb.eu											/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0003																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla security
defined('_JEXEC') or die;
jimport('joomla.application.component.view');

class JooSamViewReqevt extends JView{

	protected $form;
	protected $item;

	public function display($tpl = null){

		$form = $this->get('Form');
		$item = $this->get('Item');
		$samcats = JoosamModelReqevt::samdata();
 
		// Check for errors.
		if (count($errors = $this->get('Errors'))){
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
		$this->form = $form;
		$this->item = $item;
		$this->samcats = $samcats;
		$this->addToolBar();
		$this->setDocument();
		parent::display($tpl);
	}

	protected function addToolBar(){
		JRequest::setVar('hidemainmenu', true);
		$canDo	= JoosamHelper::getActions();
		JToolBarHelper::title(JText::_('COM_JOOSAM_VIEWS_REQEVT_001'), 'jsmTextcodes-TitleLogo');
		if ($canDo->get('core.edit')){ JToolBarHelper::save('reqevt.save'); }
		JToolBarHelper::cancel('reqevt.cancel');
	}

	protected function setDocument(){
		// set title and css
		$scriptje = 'components' . DS . 'com_joosam' . DS . 'extras' . DS . 'script' . DS . 'joosam.reqevt.js';
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_JOOSAM_VIEWS_REQEVT_002'));
		$document->addScript($scriptje);
	}
}